class ListMetaclass(type):
    def __new__(cls, name, bases, attrs):
        attrs['add'] = lambda self, value: self.append(value)
        print(cls, name, bases)
        """
        cls: 当前准备创建的类的对象
        name: 类的名字
        bases: 类继承的父类集合
        attrs: 类的方法集合
        """
        return type.__new__(cls, name, bases, attrs)


class MyList(list, metaclass=ListMetaclass):
    pass


L = MyList()
L.add(1)
print(L)